<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .small>img {
            width: 100px;
            height: 100px;
            margin: 10px;
        }
    </style>
</head>

<body>
    <div>
        <img src="./img/2024-09-07-08-59-51-576x384.jpg" alt="">
    </div>
    <div class="small">
        <img src="./img/2024-09-05-23-58-32-576x432.jpg" alt="">
        <img src="./img/2024-09-05-06-43-23-576x384.jpg" alt="">
        <img src="./img/2024-09-03-04-29-29-576x384.jpg" alt="">
        <img src="./img/2024-09-03-04-28-57-576x384.jpg" alt="">
    </div>

    <script>
        // 小src赋值给大src
        // let imgs = document.querySelectorAll('img');

        // for (let i = 1; i < imgs.length; i++) {

        //     imgs[i].onmouseover = function () {
        //         imgs[0].src = this.src;
        //         this.style.border = '2px solid red';
        //     }

        // }

        let imgs = document.querySelectorAll('img');

        for (let index = 0; index < array.length; index++) {
            const element = array[index];

            imgs[index].onmouseover = function () {
                imgs[0].src = this.src;
                this.style.border = '2px solid red';
            }
        }
    </script>
</body>

</html>